package com.itcast.bulls.stock.finance.config;

import io.seata.spring.annotation.GlobalTransactionScanner;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SeataConfiguration {

    /**
     * 获取服务名称作为分布式事务客户端的唯一标识
     */
    @Value("${spring.application.name}")
    private String applicationId;

    @Bean
    public GlobalTransactionScanner globalTransactionScanner(){
        GlobalTransactionScanner globalTransactionScanner = new GlobalTransactionScanner(
                applicationId, "stock_trade_group");
        return globalTransactionScanner;
    }
}
